home *** CD-ROM | disk | FTP | other *** search
- // Employee.m
- //
- // Created on Fri Jan 13 15:56:20 PST 1995 by NeXT EOModeler.app Version 71
- /*
- modified by enoyau
-
- You may freely copy, distribute, and reuse the code in this example.
- NeXT disclaims any warranty of any kind, expressed or implied, as to its
- fitness for any particular use.
- */
-
- #import "Employee.h"
- #import <appkit/NXImage.h>
-
- @implementation Employee
- static NSString *localLockString;
-
- + (void)setLocalLockString:(NSString *)lockString
- {
- if(localLockString) [localLockString autorelease];
- localLockString = [lockString copy];
- }
-
- - (NSString *)lock { return lock; }
-
- - (void)dealloc
- {
- [address autorelease];
- [city autorelease];
- [first_name autorelease];
- [hire_date autorelease];
- [last_name autorelease];
- [phone autorelease];
- [state autorelease];
- [zip autorelease];
- [toJob_Title autorelease];
- [toEmp_Photo autorelease];
- [photo autorelease];
- [lock autorelease];
- [super dealloc];
- }
-
- // Determine if the EO is editable by comparing the local lock string with
- // the EO lock string stored in the database.
- - (BOOL)isEditable
- {
- return [[self lock] isEqual:localLockString];
- }
-
- - (BOOL)isLocked
- {
- return ![[self lock] isEqual:[EONull null]];
- }
-
- // lockImage is an attribute added to the Employee entity in InterfaceBuilder.
- // This method retrieves the proper lock image to be displayed in the
- // tableview.
- - lockImage
- {
- if(![self isLocked])
- return nil;
- else if([self isEditable])
- return [NXImage findImageNamed:"lock_h"];
- else
- return [NXImage findImageNamed:"lock"];
- }
-
- @end
-